function optimization_closed(LineNumber)
global ns_time s_time ns_slope s_knee ns_knee hip_pos pos_com Hminus
opt_addpath()

% initial condtion
a_fit = set_a_fit();

%%%%%%%%%%%%%% Other conditions for the optimization:
[ub,lb]  = set_ublb();
Aeq = [];
beq = [];
A = [];
b = [];
set_globalveriable(LineNumber);

end


function a_fit = set_a_fit()
opt_addpath();
load('Afit.mat', 'a0');
a_fit = flatten(a0);
end

%%
%%%%%%%%%%%%%% Flatten and unflatten the a matrix

function aflat = flatten(a)
aflat = a(:);

end

function aunflat = unflatten(aflat)

qdim = 5;
aunflat = reshape(aflat,qdim,5);

end